package client.comm.baoding.ui

import android.content.Intent
import client.comm.commlib.toast.toast
import client.comm.baoding.R
import client.comm.baoding.databinding.ActivityHmsellBinding
import client.comm.baoding.ui.vm.HmSellViewModel
import client.comm.baoding.BaseMiddleActivity
class HmSellActivity : BaseMiddleActivity<HmSellViewModel, ActivityHmsellBinding>() {
    override fun getLayout(): Int {
        return R.layout.activity_hmsell
    }

    override fun initViewModel(): HmSellViewModel = createViewModel()

    override fun initView() {
        binding.vm = viewModel
        binding.event = this
    }

    override fun observerUI() {
        viewModel.callDs.observe(this, {
            it?.let {
                if (it.isSuccess) {
                    toast("成功")
                    startActivity(Intent(this, HmjlActivity::class.java))
                    finish()
                } else {
                    toast(it.message)
                }
            }
        })
    }
}